import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    //页面路径
    path:"/login",
    //组件名称
    name:"Login",
    component:() => import('../views/Login.vue'),
  },
  {
    //页面路径
    path:"/personal",
    //组件名称
    name:"Personal",
    component:() => import('../views/Personal.vue'),
  },
  {
    //页面路径
    path:"/myOrder",
    //组件名称
    name:"MyOrder",
    component:() => import('../views/MyOrder.vue'),
  },
  {
    //页面路径
    path:"/myCollection",
    //组件名称
    name:"MyCollection",
    component:() => import('../views/MyCollection.vue'),
  },
  {
    //页面路径
    path:"/addressManage",
    //组件名称
    name:"AddressManage",
    component:() => import('../views/AddressManage.vue'),
  },
  {
    //页面路径
    path:"/productdetail",
    //组件名称
    name:"ProductDetail",
    component:() => import('../views/ProductDetail.vue'),
  },
  {
    //页面路径
    path:"/order",
    //组件名称
    name:"Order",
    component:() => import('../views/Order.vue'),
  },
  // 一级路由
  {
    //组件路径
    path:"/main",
    //组件名称
    name:"Main",
    component:() => import('../views/Main.vue'),
    // 二级路由
    children:[
      {
        //页面路径
        path:"home",
        //组件名称
        name:"Home",
        component:() => import('../views/Home.vue'),
      },
      {
        //页面路径
        path:"menu",
        //组件名称
        name:"Menu",
        component:() => import('../views/Menu.vue'),
      },
      {
        //页面路径
        path:"shopbag",
        //组件名称
        name:"Shopbag",
        component:() => import('../views/Shopbag.vue'),
      },
      {
        //页面路径
        path:"my",
        //组件名称
        name:"My",
        component:() => import('../views/My.vue'),
      },
    ]
  },
  // 路由重定向
  {
    path:"*",
    redirect:{
      name:"Shopbag"
    }
  }
]

const router = new VueRouter({
  routes
})

export default router
